// 访问器

class Person {
  private _name: string
  constructor(name: string) {
    this._name = name
  }
  // 访问器 setter / getter
  set name(newName: string) {
    this._name = newName
  }
  get name() {
    return this._name
  }

}

const p = new Person('cht')
p.name = 'why'
console.log(p.name)

export { }